<style>
    .disabledInput {
        filter: alpha(opacity=60);
        -moz-opacity: 0.6;
        -khtml-opacity: 0.6;
        opacity: 0.6;
    }
</style>
<toaster-container toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
<div>
    <h2>ES归档配置</h2>
    <label>基地</label>
    <select kendo-drop-down-list ng-model="locationId"
            k-options="locationOptions">
    </select>
    <kendo-button class="k-primary" ng-click="query()">查询</kendo-button>
    <kendo-button class="k-primary" ng-click="insert()">新增</kendo-button>
    <kendo-button class="k-primary" ng-click="save()">保存</kendo-button>
    <table class="table table-hover">
        <thead>
        <tr>
            <th class="col-sm-2">序号</th>
            <th class="col-sm-2">描述(description)</th>
            <th class="col-sm-2">数值(value)</th>
            <th class="col-sm-2">时间格式(timestring)</th>
            <th class="col-sm-1">单位(unit)</th>
            <th class="col-sm-1">数值(unit_count)</th>
            <th class="col-sm-2">关闭此配置(disable_action)</th>
        </tr>
        </thead>
        <tbody ng-repeat="item in counts">
        <tr>
            <td>{{item}}</td>
            <td><textarea ng-model="source.actions[item].description"></textarea></td>
            <td><input type="text" ng-model="source.actions[item].filters[0].value"></td>
            <td><input type="text" ng-model="source.actions[item].filters[1].timestring"></td>
            <td><input type="text" ng-model="source.actions[item].filters[1].unit_count"></td>
            <td><input type="text" ng-model="source.actions[item].filters[1].unit"></td>
            <td><input type="checkbox" ng-model="source.actions[item].options.disable_action" style="margin-left: 10px; margin-right: 40px">
                <kendo-button class="k-primary" ng-click="delete(item)">删除</kendo-button></td>
        </tr>
        </tbody>
    </table>
</div>
<div kendo-window="win" k-options="winOptions" k-title="win.title"
     k-visible="false">
    <div class=" textboxes">
        <div class="form-inline group-margin">
            <table class="table table-condensed table-striped table-bordered table-responsive"
                   style="table-layout:fixed">
                <!--<thead>-->
                <!--<tr>-->
                <!--<th class="col-sm-4">属性</th>-->
                <!--<th class="col-sm-4">说明</th>-->
                <!--<th class="col-sm-4">值</th>-->
                <!--</tr>-->
                <!--</thead>-->
                <tbody>
                <!--<tr>-->
                <!--<td>{{count+1}}</td>-->
                <!--</tr>-->
                <tr hidden="true">
                    <td>action</td>
                    <td>动作</td>
                    <td><input type="text" ng-model="data.action" disabled="false" class="disabledInput"></td>
                </tr>
                <tr>
                    <td>description</td>
                    <td>描述</td>
                    <td><textarea ng-model="data.description"></textarea></td>
                </tr>
                <tr>
                    <td>filters[0]</td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;filtertype</td>
                    <td>filter类型</td>
                    <td><input type="text" ng-model="data.filters[0].filtertype" disabled="false" class="disabledInput">
                    </td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;kind</td>
                    <td>种类</td>
                    <td><input type="text" ng-model="data.filters[0].kind" disabled="false" class="disabledInput"></td>
                </tr>
                <tr>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;value</td>
                    <td>数值</td>
                    <td><input type="text" ng-model="data.filters[0].value"></td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;exclude</td>
                    <td>排除</td>
                    <td><input type="text" ng-model="data.filters[0].exclude" disabled="false" class="disabledInput">
                    </td>
                </tr>

                <tr>
                    <td>filters[1]</td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;filtertype</td>
                    <td>filter类型</td>
                    <td><input type="text" ng-model="data.filters[1].filtertype" disabled="false" class="disabledInput">
                    </td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;source</td>
                    <td>源</td>
                    <td><input type="text" ng-model="data.filters[1].source" disabled="false" class="disabledInput">
                    </td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;direction</td>
                    <td>方向</td>
                    <td><input type="text" ng-model="data.filters[1].direction" disabled="false" class="disabledInput">
                    </td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;timestring</td>
                    <td>时间格式</td>
                    <td><input type="text" ng-model="data.filters[1].timestring" disabled="false" class="disabledInput">
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;unit</td>
                    <td>单位</td>
                    <td><input type="text" ng-model="data.filters[1].unit"></td>
                </tr>
                <tr>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;unit_count</td>
                    <td>数值</td>
                    <td><input type="text" ng-model="data.filters[1].unit_count"></td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;exclude</td>
                    <td>排除</td>
                    <td><input type="text" ng-model="data.filters[1].exclude" disabled="false" class="disabledInput">
                    </td>
                </tr>

                <tr hidden="true">
                    <td>options</td>
                    <td></td>
                    <td></td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;timeout_override</td>
                    <td>超时重写</td>
                    <td><input type="text" ng-model="data.options.timeout_override" disabled="false"
                               class="disabledInput"></td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;continue_if_exception</td>
                    <td>如果有异常是否继续</td>
                    <td><input type="checkbox" ng-model="data.options.continue_if_exception" disabled="false"></td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;ignore_empty_list</td>
                    <td>允许为空</td>
                    <td><input type="checkbox" ng-model="data.options.ignore_empty_list" disabled="false"></td>
                </tr>
                <tr hidden="true">
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;disable_action</td>
                    <td>关闭此配置</td>
                    <td><input type="checkbox" ng-model="data.options.disable_action" disabled="false"></td>
                </tr>
                </tbody>
            </table>
            <div style="text-align:center">
                <div class="form-group">
                    <kendo-button class="k-primary" ng-click="determain()">确定</kendo-button>
                </div>
                <div class="form-group">
                    <kendo-button class="k-primary" ng-click="cancel()">取消</kendo-button>
                </div>
            </div>
        </div>
    </div>
</div>
<div kendo-dialog="dialog" k-title="'删除配置'" k-on-open="dialogVisible = true" k-visible="false"
     k-on-close="dialogVisible = false" k-width="300" k-height="150"
     k-actions="dialogActions" k-modal="true">
    <p>确定要删除吗？</p>
</div>

